import { Children, lazy } from "react";
import AIIcon from "../components/aiicon/AIIcon";
import {
    AppstoreOutline,
    ShopbagOutline,
    AddOutline,
    FileOutline,
    UserOutline,
} from 'antd-mobile-icons'


let Main = lazy(() => import('../pages/main/Index'))
let Home = lazy(() => import('../pages/home/Index'))
let Ai = lazy(() => import('../pages/ai/Index'))
let Code = lazy(() => import('../pages/code/Index'))
let Shopp = lazy(() => import('../pages/shopp/Index'))
let User = lazy(() => import('../pages/user/Index'))
let Login = lazy(() => import('../pages/login/Index'))
let Register = lazy(() => import('../pages/register/Index'))
let Search = lazy(() => import('../pages/search/Index'))
let Shoppcat = lazy(() => import('../pages/shoppcat/Index'))
let Detail = lazy(() => import('../pages/detail/Index'))
let Homedetail = lazy(() => import('../pages/homedetail/Index'))
let Address = lazy(() => import('../pages/address/Index'))
let AddAddress = lazy(() => import('../pages/addAddress/Index'))
let Addcode = lazy(() => import('../pages/addcode/Index'))
let Consultation = lazy(() => import('../pages/Consultation/Index'))
export const homeRouter = [
    {
        path: '/',
        element: <Home />,
        title: '春雨',
        icon: <AppstoreOutline />
    },
     {
        path: '/shopp',
        element: <Shopp/>,
        title: '商城',
        icon: <ShopbagOutline />
    },
     {
        path: '/ai',
        element: <Ai/>,
        title: '慧问AI',
        icon: <AIIcon />
    },
     {
        path: '/code',
        element: <Code />,
        title: '我的订单',
        icon: <FileOutline />
    },
     {
        path: '/User',
        element: <User />,
        title: '个人中心',
        icon: <UserOutline />
    },
]

export const routes = [
    {
        path: '/',
        element: <Main />,
        children: homeRouter.filter(r => r.path !== '/ai')
    },
    {
        path: '/ai',
        element: <Ai />,
    },
    {
        path: '/login',
        element: <Login />,
    },
    {
        path: '/register',
        element: <Register />,
    },
    {
        path: '/search',
        element: <Search />,
    },
    {
        path: '/shoppcat',
        element: <Shoppcat />,
    },
    {
        path: '/detail/:shop_spu_id',
        element: <Detail />,
    },
    {
        path: '/homedetail/:id',
        element: <Homedetail />,
    },
    {
        path: '/address',
        element: <Address />,
    },
    {
        path: '/addAddress/:flag?',
        element: <AddAddress />,
    },
    {
        path: '/addcode',
        element: <Addcode />,
    }, 
    {
        path: '/consultation',
        element: <Consultation />,
    },

]